using System;

namespace Scenario.Modules.FormHelper
{
	//*********************************************************************
	//
	// ProcessAction Class
	//
	// The XMLProcessAction class represents a single operation to do on a 
	// process instance. It contains also activity operation on a ow
	//
	//*********************************************************************

	public class XMLProcessAction : bOSdotNET.XML.Data.XMLObjectSet
	{
		public const string MAIN_NODE	= "ProcessAction";

		/** FIELDS **/

		public XMLActivityAction ActivityAction;
		public XMLFlags vFlags;

		/** CONSTRUCTORS **/

		/** CONSTRUCTOR Empty **/
		public XMLProcessAction()
		{
			this.Init();
		}

		/** CONSTRUCTOR Width XML parsering**/
		public XMLProcessAction(System.Xml.XmlNode nodeList)
		{
			this.Parse (nodeList);
		}

		/** Properties **/

		/** no Properties **/


		/** INSTANCE METHODS **/

		override public void Init()
		{
			vFlags = new XMLFlags();
			ActivityAction = new XMLActivityAction();
		}

		override public void Parse(System.Xml.XmlNode nodeList)
		{
			this.Init();

			System.Xml.XmlNode node;

			/** find subcollection fileds to add **/
			for ( int i=0; i<nodeList.ChildNodes.Count;i++)
			{
				node = nodeList.ChildNodes[i];

				switch ( node.Name) 
				{
					case XMLFlags.MAIN_NODE:
						vFlags.Parse(node);
						break;

					case XMLActivityAction.MAIN_NODE:
						ActivityAction.Parse(node);
						break;
				}
			}

		}

		override public bOSdotNET.XML.XMLNode GetXMLNode()
		{
			bOSdotNET.XML.XMLNode XMLNode = new bOSdotNET.XML.XMLNode(XMLProcessAction.MAIN_NODE);
			XMLNode.AddNode (ActivityAction.GetXMLNode());
			XMLNode.AddNode (vFlags.GetXMLNode());

			return XMLNode;
		}
		
	}
}
